Repository navigation
feat(kms-auth)!: pass the TEE platform to policies and allow restricting it - #1567
Merged
Merged
Conversation
kvinwang
force-pushed
the
feat/iappauth-v2
branch
from
November 12, 2026 10:53
796efb5 to
e5a597f
Compare
kvinwang
force-pushed
the
feat/iappauth-v2
branch
5 times, most recently
from
November 12, 2026 12:10
3108ac0 to
0f55944
Compare
…ing it One OS image hash can boot on several TEE platforms (a release ships both TDX and SEV-SNP firmware), and app keys derive from the app ID alone, so an app approved on bare-metal TDX could be served on any platform the KMS enables. The KMS already sends teeVariant; auth-eth dropped it. - Append teeVariant, the platform name the KMS reports, to the AuthorizationRequest of IAppEpochAuth. auth-eth passes it through unchanged, so the KMS defines the names and each policy picks its own representation. AppInfo is unchanged, so DstackKms still forwards it as is to policies without IAppEpochAuth. - DstackApp and DstackKms allow any platform until the owner calls setAllowAnyTeeVariant(false), then only the names set by setAllowedTeeVariants. TeeVariantPolicy keeps them as one packed slot: a restricted flag and a bitmask over the platform names it hardcodes, so a check costs one read; listing an unknown name reverts, and a restricted policy refuses one. The policy covers every epoch: which platforms may hold keys is a trust decision, not a property of a key generation. A restricted policy refuses the legacy isAppAllowed/isKmsAllowed, whose callers report no platform; the 0.6.x KMS also serves SEV-SNP and Nitro, so they cannot be taken as TDX. - auth-eth requires teeVariant on /authorizeKms and /authorizeApp. - Manage.s.sol SetKmsTeeVariants/SetTeeVariants take TEE_VARIANTS=any or a list of names and refuse an empty one; Query.s.sol prints the policies. DstackKms stays under the EIP-170 limit at 24,041 bytes. BREAKING CHANGE: unreleased ABI only: authorizeKms/authorizeApp, and the IAppEpochAuth and IAppEpochManagement (now 0x8c0524c4) interface IDs. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
force-pushed
the
feat/iappauth-v2
branch
from
November 12, 2026 12:27
0f55944 to
cc1d4b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One OS image hash can boot on several TEE platforms, and app keys derive from the app ID alone, so a policy that cannot see the platform cannot keep an app on, say, bare-metal TDX. The KMS already sends
teeVariant; auth-eth dropped it before the contract call.teeVariant(the platform name the KMS reports, passed through unchanged) to theAuthorizationRequestofIAppEpochAuth.AppInfois unchanged, so legacyIAppAuthpolicies still get it as is.DstackAppandDstackKms:allowAnyTeeVariant()(default true, also for upgraded proxies) andallowedTeeVariants(), set bysetAllowAnyTeeVariant(bool)/setAllowedTeeVariants(string[]), covering every epoch. Stored as one packed slot (restricted flag + bitmask over the names hardcoded inTeeVariantPolicy.sol); listing an unknown name reverts and a restricted policy refuses it, as it does the legacyisAppAllowed/isKmsAllowed.teeVarianton/authorizeKmsand/authorizeApp.Manage.s.sol:SetKmsTeeVariants/SetTeeVariants(TEE_VARIANTS=anyor names);Query.s.solprints the policies.DstackKmsis 24,041 bytes (EIP-170 limit 24,576). Breaking only for unreleased ABI:authorizeKms/authorizeApp,IAppEpochAuth,IAppEpochManagement(now0x8c0524c4).Tests:
forge clean && forge test --ffi(114 passed),vitest run(58 passed), HalmosDstackAppEpochSymbolicTest(10/10, including a new platform-policy property).